package meihua.stopcarapp.presenter;

import android.util.Log;

import java.util.List;

import meihua.mylibrary.baserx.RxSubscriber;
import meihua.stopcarapp.R;
import meihua.stopcarapp.bean.CouponEntity;
import meihua.stopcarapp.presenter.contract.StopCarQuanContract;

/**
 * Name: LGZ
 * Time: 2017/5/18.
 * Dec:
 */

public class StopCarQuanPresenter extends StopCarQuanContract.Presenter {
    @Override
    public void getCouponListRequest(String user_id) {
        mRxManage.add(mModel.getCouponList(user_id)
                .subscribe(new RxSubscriber<List<CouponEntity>>(mContext,false) {
                    @Override
                    public void onStart() {
                        super.onStart();
                        mView.showLoading(mContext.getString(R.string.loading));
                    }
                    @Override
                    protected void _onNext(List<CouponEntity> entities) {
                        mView.returnCouponList(entities);
                        mView.stopLoading();
                    }
                    @Override
                    protected void _onError(String message) {
                        Log.d("ligaozeng","服务器错误:"+message);
                    }
                }));
    }
}
